package eddy.yang.wordpad;

import java.io.File;
import javax.swing.Icon;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileView;

public class FileIconView extends FileView {
   public FileIconView(FileFilter filter, Icon icon) {
      this.filter = filter;
      this.icon = icon;
   }
   
   public Icon getIcon(File f) {
      if(!f.isDirectory() && filter.accept(f))
         return this.icon;
      else
         return null;
   }
   
   private FileFilter filter;
   private Icon icon;
}
